// 先定义Animal类
abstract class Animal {
    protected String name;
    protected String type;
    protected String breed;
    protected double price;

    public Animal(String name, String type, String breed, double price) {
        this.name = name;
        this.type = type;
        this.breed = breed;
        this.price = price;
    }

    public abstract void eat();

    public abstract void sleep();

    public abstract void play();

    public abstract void makeSound();

    @Override
    public String toString() {
        return "Name: " + name + ", Type: " + type + ", Breed: " + breed + ", Price: " + price;
    }
}

// 小狗类
class Dog extends Animal {
    public Dog(String name, String type, String breed, double price) {
        super(name, type, breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing.");
    }

    @Override
    public void makeSound() {
        System.out.println(name + " says: Woof!");
    }
}

// 小猫类
class Cat extends Animal {
    private boolean isPlaying = false;

    public Cat(String name, String type, String breed, double price) {
        super(name, type, breed, price);
    }

    @Override
    public void eat() {
        System.out.println(name + " is eating.");
    }

    @Override
    public void sleep() {
        System.out.println(name + " is sleeping.");
    }

    @Override
    public void play() {
        System.out.println(name + " is playing and says: Meow!");
        isPlaying = true;
    }

    @Override
    public void makeSound() {
        if (isPlaying) {
            System.out.println(name + " says: Meow!");
        } else {
            System.out.println(name + " is quiet.");
        }
    }
}

public class Main {
    public static void main(String[] args) {
        Dog dog1 = new Dog("Buddy", "Dog", "Golden Retriever", 500.0);
        Dog dog2 = new Dog("Max", "Dog", "German Shepherd", 600.0);
        Cat cat1 = new Cat("Whiskers", "Cat", "Persian", 400.0);
        Cat cat2 = new Cat("Misty", "Cat", "Siamese", 300.0);


    }
}


